﻿using BackData;
using Domain.DTOs.RBAC;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Team.API.Applocation.Command;

namespace Team.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class LoginsController : ControllerBase
    {
        private readonly IMediator mediator;

        public LoginsController( IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns>返回用户信息</returns>
        [HttpPost]
        public async Task<APIResult<UserDTO>> Login(LoginUserCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
